# s = "Hello\\World!"
# print(s)
# print(s[0])
# print(s[3])  # 字符串下标对应的字符

# length = len("Hello")
# print(length)  # 统计字符串的长度

# num = s.count("l")
# print(num)  # 统计子字符串在原字符串中出现的次数
# s = "hello world hello Python"
# n = s.count("o")
# print(n)
# n = s.count("or")
# print(n)
# n = s.count("o", 10, 30)
# print(n)   #  指定查找范围

# s = "Hello"
# print(s.index("l"))   # 检查子字符串是否在字符串中并输出第一个位置
# print(s.index("l",0,3))  # 指定范围 区间使用下标位置，左闭右开区间
# s = "Hello"
# print(s.rindex("l"))
# print(s.rindex("l",0,3))

# s = "Hello"
# print(s.find("l"))
# print(s.find("l",0,3))
# print(s.find("k"))
# print(s.rfind("l"))
# print(s.rfind("l",0,3))

# s = "Hello Hello Hello Hello"
# print(s.replace("ll", "LL",2))  # 替换ll不超过2次

# url = "https://www.ceshiren.com"
# print(url.startswith("http", 0, 4))
# print(url.endswith("com", 5, 20))  # 检查开头或结尾

# print("abc".isalpha())
# print("123abc".isalpha())   # 字符不为空且都是字母
#
# print("123".isdigit())
# print("123abc".isdigit())   # 只包含数字
#
# print("123".isalnum())
# print("123abc".isalnum())   # 字符不为空且都是字母或数字

# print(" ".isspace())
# print("\t".isspace())    #  只包含空格类的内容

# print("123ABC".isupper())   # 都是大写字母
# print("123abc".islower())   # 都是小写字母
# print("AbcName".istitle())
# print("Abc Name".istitle())   # 所有单词首字母是大写

# print("abcABC".upper())   # 所有的字母变为大写
# print("abcABC".lower())   # 所有的字母变为小写

# print("|"+"hogworts".center(10) + "|")
# print("|"+"hogworts".center(10, "-") + "|")

# print("|" + "  hogworts  ".strip() + "|")
# print("|" + "bachogwortsabc".strip("cba") + "|")  # 删除两侧的空白

# print("a-b-c-d".split("-"))
# print("a b c d e".split(" ", 3))   # 分隔 默认空格
# print("a\nb\nc".splitlines())
# print("a\nb\nc".splitlines(True))

# print("Hello" + "World")
# print("hello"* 10)
# print("-".join(("a", "b", "c")))
# print("->".join(("a","b","c")))

# s = "abcdefg"
# # 普通切片
# print(s[0: 2])
# # 省略范围
# print(s[0:])
# print(s[: 2])
# print(s[:])
# # 指定步长
# print(s[::1])
# # 负下标
# print(s[-3: -1])
# # 负步长
# print(s[-1: -3: -1])
# # 逆序
# print(s[::-1])

# name = "A"
# message = f"My name is {name}."
# print(message)

# l1 = [1, 2, 3, "hello", True]
# print(l1)
# print(type(l1))
# l2 = list("abc")
# print(l2)
# print(l1[3])   引用
# l1[3] = False  修改
# print(l1)   切片
# print(l1[0:3])
# print(l1[3:])
# print(l1[:])
# print(l1[::-1])
l = [1, 2, 3, 1, 1, "hello", False]
print(l.count(1))
l = [1,2,3,4,5,1,2,3,3]
print(l.index(3))
print(l.index(3,5,10))
l.append(6)
print(l)
l.extend("456")
print(l)
l.insert(1,"A")
print(l)
del l[1]
print(l)
l.remove(3)
print(l)
l.clear()
print(l)
l = [1,2,3,4,5,1,2,3,3]
l.sort()
print(l)


